package com.huilian.iotbox.admin.quartz.job;

import com.huilian.iotbox.admin.service.StatsPackageStoreService;
import com.huilian.iotbox.data.enums.StatisticsTypeEnum;
import com.huilian.iotbox.data.utils.DateTimeUtils;
import lombok.extern.slf4j.Slf4j;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author LinYinDong
 * @date 2023/7/28 9:41
 */
@Slf4j
public class StatsDayPackageStoreJob implements BaseJob{
    @Autowired
    private StatsPackageStoreService statsPackageStoreService;
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        log.info("--------------定时任务 套餐订单 统计开始 时间{}---------------", DateTimeUtils.currTime());

        //获取昨天 1970-01-01 00：00：00
        String startTime = DateTimeUtils.getYesterdayStartTime();
        //获取昨天 1970-01-01 23：59：59
        String endTime = DateTimeUtils.getYesterdayEndTime();

        // 昨天，1970-01-01
        String yesterday = DateTimeUtils.getYesterday();

        statsPackageStoreService.statsDayPackageStoreJob(startTime, endTime, yesterday,StatisticsTypeEnum.DAY.getCode());

        log.info("--------------定时任务 套餐订单 统计结束 end时间{}---------------", DateTimeUtils.currTime());
    }
}
